import request from '@/utils/request'

enum Api {
  list = '/patrolPointUav/loadList',
  save = '',
  edit = '/patrolPointUav/update',
  delete = '/patrolPointUav/delete',
  upload = '',
  import = '/patrolPointUav/importData',
  export = ''
}

/**
 * 导入Xlsx/Json
 * @param data
 */
export const importFile = async (data: FormData) => {
  return await request.post(Api.import, {
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 列表
 * @param data
 */
export const list = async (data: {
  pageNum: number
  pageSize: number
  name?: undefined | string
  deviceName?: undefined | string
  partName?: undefined | string
}) => {
  return await request.post(Api.list, { data })
}

/**
 * 修改
 * @param data
 */
export const editOne = async (data: {
  id?: undefined | number | string
  isMultiplePatrol?: undefined | number | string
  threeDimensionalParam?: undefined | string
}) => {
  return await request.post(Api.edit, { data })
}

/**
 * 删除
 * @param id
 */
export const delOne = async (params: { id: number }) => {
  return await request.delete(Api.delete, { params })
}

/**
 * 部件图片Url
 * @param id
 */
export const getImgUrl = async (params: { id: number | string }) => {
  return await request.get('/LabelUav/getPartImageUrl', { params })
}

/**
 * 要标定设备名称列表
 * @param id
 */
export const getDevList = async (params?: { id: number }) => {
  return await request.get('/LabelUav/getDeviceLabelDTOList', { params })
}

/**
 * 标定设备列表
 * @param id
 */
export const getUavDevList = async (params?: { labelId: number | string }) => {
  return await request.get('/LabelUav/loadLabelDetail', { params })
}

/**
 * 标定
 * @param data
 */
export const draw = async (data: {
  labelId?: undefined | number | string
  deviceId?: undefined | number | string
  deviceName?: string
  algSeqName?: string
  deviceLocation?: string
}) => {
  return await request.post('/LabelUav/label', { data })
}

/**
 * 删除标定
 * @param id
 */
export const delDraw = async (params: { id: number | string }) => {
  return await request.delete('/LabelUav/deleteLabel', { params })
}
